package com.example.user_service.dao;

import com.example.user_service.vo.Administrator;
import com.example.user_service.vo.CollectGoods;
import com.example.user_service.vo.Mingxi;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

@Repository
@Mapper
public interface UserInsert {
    //gfc 插入基本数据
    @Insert("insert into user_data(user_id,user_name,user_birthday,user_img,user_area,user_zsxm,user_createtime) " +
            "values(#{userid},#{account},now(),'http://127.0.0.1:16600/img/headimg/fcbh.png','北京',#{zsname},now())")
    Integer insert_user_data(int userid, String account, String zsname);

    //gfc 插入login数据

    @Insert("insert into user_login(tel,account,paswd,idcard) values(#{tel},#{account},#{paswd},#{idcard})")
    Integer insert_user_login(String tel, String account, String paswd, String idcard);

    //gfc 插入会员数据
    @Insert("insert into user_member values(#{userid},#{menberid},1,0,1,0,0,now(),now(),now())")
    Integer insert_user_menber(int userid, String menberid);

    /* 添加管理员
     * @author Liu
     * @date 2021/12/15 1:29
     * @param null
     * @return
     * @throws
     * @since
     */
    @Insert("insert into administrator(account,pawd,state,createdatetime) value(${account},'${pawd}',1,now());" +
            "insert into user_data values(${account},' ',now(),0,' ',' ',' ',now(),' ');" +
            "insert into user_login values(${account},'${account}','${account}','${account}',' ',0,'${account}',now())")
    int create_Administrator(Administrator administrator);

    /* 新增我的足迹
     * @author Liu
     * @date 2021/12/17 15:22
     * @param null
     * @return
     * @throws
     * @since
     */
    @Insert("insert into my_tracks(user_id,Footprint_id,tracks_state,tracks_create,goods_type) value(${user_id},${footprint_id},1,now(),${goods_type})")
    int insert_my_tracks(int user_id, int footprint_id, int goods_type);

    /* 新增收藏
     * @author Liu
     * @date 2021/12/20 8:29
     * @param null
     * @return
     * @throws
     * @since
     */
    @Insert("insert into collect_goods(user_id,Commodity_id,Collection_create) value(${user_id},${footprint_id},now())")
    int insert_collect_goods(int user_id, int footprint_id);


    @Insert("insert into administrator_role value(${account},${role_name})")
    int create_admi_root( Administrator administrator);


    @Insert("insert into jifenmingxi(userid,commodity_name,commodity_picture,attribute,jifen,date,beizhu) " +
            "values(#{userid},#{commodity_name},#{commodity_picture},#{attribute},#{jifen},now(),'无')")
    int insert_jf(Mingxi mingxi);



}
